package com.songcha.library_common.util

import android.content.Context
import android.graphics.Bitmap
import android.graphics.Color
import android.os.Build

class ColorUtil {
    companion object{
        @JvmStatic
        fun getResourceColor(context: Context?, resId:Int):Int{
              context?.let {
                if(Build.VERSION.SDK_INT<23){
                    return context.resources.getColor(resId)
                }else{
                    return context.getColor(resId)
                }
            }
            return Color.TRANSPARENT

        }
        @JvmStatic
        fun color2ScreenBitmap(color:Int):Bitmap{
            val bmp = Bitmap.createBitmap(
                ScreenUtil.getScreenWidth(),
                ScreenUtil.getScreenHeight(), Bitmap.Config.ARGB_8888)
            bmp.eraseColor(color)
            return bmp
        }

    }
}